package cn.edu.hunau.basic.day05;

import org.junit.Test;

/**
 * @author hb
 * @date 2025-08-01 14:42:24
 */
public class CallBackTest {
    @Test
    public void testCallBack(){
        System.out.println(f(50));
    }

    @Test
    public void test03(){
        System.out.println(div(20));
    }

    public long div(long n){
        if(n==1){
            return 1l;
        }
        return n*div(n-1);
    }

    @Test
    public void testF2(){
        System.out.println(f2(50));
    }

    public long f2(long n){
        long f1=1l;
        long f2=1l;
        for(long j=3l;j<=n;j++){
            f2=f2+f1;
            f1=f2-f1;
        }
        return f2;
    }

    public long f(long n){
        if(n==1 || n==2){
            return 1l;
        }
        return  f(n-1)+f(n-2);
    }
}
